/***
 * Julia: France Telecom's implementation of the Fractal API Copyright (C)
 * 2001-2002 France Telecom R&D
 * 
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2 of the License, or (at your option) any
 * later version.
 * 
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library; if not, write to the Free Software Foundation, Inc.,
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 * 
 * Contact: Eric.Bruneton@rd.francetelecom.com
 * 
 * Author: Eric Bruneton
 */

public class ServerImpl implements Service, ServiceAttributes {

	private String header = "";

	private int count = 0;

	// modification : retour erreur si vide ou null, sinon retour done
	public String print(final String msg) {
		new Exception() {
			public String toString() {
				return "Server: print method called";
			}
		}.printStackTrace();
		System.err.println("Server: begin printing...");
		if (!msg.isEmpty() && msg != null) {
			for (int i = 0; i < count; ++i) {
				System.err.println(header + msg);
			}
			System.err.println("Server: print done.");
		} else {
			return new String("ERREUR : chaîne vide.");
		}

		return new String("done");
	}

	public String getHeader() {
		return header;
	}

	public void setHeader(final String header) {
		this.header = header;
	}

	public int getCount() {
		return count;
	}

	public void setCount(final int count) {
		this.count = count;
	}
}
